<html>
<head><meta charset="utf-8"><title>Reproduction tips and tricks · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html">Reproduction tips and tricks</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="248261647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248261647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248261647">(Aug 03 2021 at 18:40)</a>:</h4>
<p>Hey folks,</p>
<p>I have a fairly complex program that exibits a really weird bug in rustc. It's apparently fixed on the latest nightlies, but it's weird enough (probably a codegen bug) that I would like to figure out what it actually is to make sure it doesn't crop up again. Unfortunately, it is exhibited in the program at runtime, with fairly complex requirements. Any pro-level tips and tricks to get it to something that's better for a bug report?</p>



<a name="248262127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248262127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248262127">(Aug 03 2021 at 18:44)</a>:</h4>
<p>alternatively, if this sounds like any recent bugs that were fixed, that would also be of use:</p>
<blockquote>
<p>The symptom is that if I call a function that itself takes a closure as an argument in this particular function, the program explodes its memory use and ultimately dies. The flamegraph shows what I would expect if I were pushing something onto a Vec in a loop.</p>
</blockquote>
<p>I couldn't think of any, but haven't been reading the tracker as closely for the last few weeks.</p>



<a name="248262420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248262420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248262420">(Aug 03 2021 at 18:47)</a>:</h4>
<p>do you have an idea on when it started appearing by any chance ?</p>



<a name="248262794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248262794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248262794">(Aug 03 2021 at 18:50)</a>:</h4>
<p>that is a good question. turns out that i have figured out what changed. it disappeared with the move to llvm 12. nightly was older than i expected. so, unlikely to be a useful bug report to rustc. thank you!</p>



<a name="248262946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248262946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248262946">(Aug 03 2021 at 18:51)</a>:</h4>
<p>it's always right after you ask for help that you figure something out, haha <span aria-label="confused" class="emoji emoji-1f615" role="img" title="confused">:confused:</span> appreciate it</p>



<a name="248263174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248263174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248263174">(Aug 03 2021 at 18:53)</a>:</h4>
<p>You can try running some automated reduction tooling (e.g., creduce, perses) on it to try to minify the test case, presuming it's reproducible, but generally if it's fixed on nightly / with llvm 12 it's unlikely to be too important. Could be a nice codegen test though!</p>



<a name="248263179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248263179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248263179">(Aug 03 2021 at 18:53)</a>:</h4>
<p>this sounded familiar to me at least, but older than the last few weeks</p>



<a name="248263698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248263698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248263698">(Aug 03 2021 at 18:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116011">@Steve Klabnik</span> if you have a repro we can try to help minimizing it</p>



<a name="248264471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248264471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248264471">(Aug 03 2021 at 19:02)</a>:</h4>
<p>thanks! yeah the issue is that like, it manifests when you run this code and you have a certain peripheral connected to your computer; i don't even have the necessary things to reproduce right now and it's my job, heh. if we manage to get it to something more reasonably reproducible, ill file something or ask more. there's no unsafe code.</p>



<a name="248264527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248264527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248264527">(Aug 03 2021 at 19:03)</a>:</h4>
<p>yeah it's older than a few weeks, </p>
<div class="codehilite"><pre><span></span><code>C:\Users\steve\Documents\Oxide\pmbus(rework)&gt; rustc +nightly-2021-03-04 --version --verbose
rustc 1.52.0-nightly (476acbf1e 2021-03-03)
binary: rustc
commit-hash: 476acbf1e9965b5e95c90f0d7d658709812b7003
commit-date: 2021-03-03
host: x86_64-pc-windows-msvc
release: 1.52.0-nightly
LLVM version: 11.0.1
C:\Users\steve\Documents\Oxide\pmbus(rework)&gt; rustc +nightly-2021-03-05 --version --verbose
rustc 1.52.0-nightly (45b3c2851 2021-03-04)
binary: rustc
commit-hash: 45b3c28518e4c45dfd12bc2c4400c0d0e9639927
commit-date: 2021-03-04
host: x86_64-pc-windows-msvc
release: 1.52.0-nightly
LLVM version: 12.0.0
</code></pre></div>
<p>bug before, no bug after</p>



<a name="248264849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248264849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248264849">(Aug 03 2021 at 19:05)</a>:</h4>
<p>I would suggest rust-reduce --even if it's slow -- instead of the other tools mentioned above, because it likely involves multiple files. And if it also involves reducing over multiple crates at the same time, it's going to be a pain even with that. In any case, let us know if you need help reducing</p>



<a name="248265020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248265020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248265020">(Aug 03 2021 at 19:06)</a>:</h4>
<p>yep, that is exactly it. appreciate it.</p>



<a name="248265130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248265130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248265130">(Aug 03 2021 at 19:07)</a>:</h4>
<p>i forgot about rust-reduce, will give it a try though, thank you.</p>



<a name="248265675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248265675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248265675">(Aug 03 2021 at 19:10)</a>:</h4>
<p>hopefully it gets you to a single-file repro where the other tools can also help (sometimes even for multiple-crate projects, the issue can be localized to a single one and ultimately the others can be removed instead of also reduced)</p>



<a name="248265748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248265748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248265748">(Aug 03 2021 at 19:11)</a>:</h4>
<p>once you're there I'd also suggest lithium (I myself have not been able to make perces work)</p>



<a name="248270156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248270156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248270156">(Aug 03 2021 at 19:45)</a>:</h4>
<p>(maybe also check under cargo-bisect-rustc just to make sure it was indeed fixed by the LLVM update and not another PR on the same nightly -- although the CI artifacts may be gone already. And also if you want to have an idea of when it was introduced, just in case something interesting comes up there as well, if it's not another LLVM update)</p>



<a name="248523775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248523775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steve Klabnik <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248523775">(Aug 05 2021 at 19:23)</a>:</h4>
<p>closing the loop here: we tracked it down to <a href="https://github.com/rust-lang/rust/issues/78283">https://github.com/rust-lang/rust/issues/78283</a>, which has an llvm fix from <span class="user-mention" data-user-id="116083">@pnkfelix</span> <span aria-label="muscle" class="emoji emoji-1f4aa" role="img" title="muscle">:muscle:</span> thanks again</p>



<a name="248524192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Reproduction%20tips%20and%20tricks/near/248524192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Reproduction.20tips.20and.20tricks.html#248524192">(Aug 05 2021 at 19:26)</a>:</h4>
<p>(technically the fix that landed on LLVM was from <span class="user-mention" data-user-id="133224">@Nikita Popov</span> ; my proposed fix was problematic in multiple ways. But glad to hear your problem was addressed, nonetheless!)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>